package com.ccjq.shosestore.web.controller.product;

import com.ccjq.shosestore.product.bo.Category;
import com.ccjq.shosestore.product.bo.Product;
import com.ccjq.shosestore.product.bo.Slider;
import com.ccjq.shosestore.product.service.ProductService;
import com.ccjq.shosestore.product.service.impl.ProductServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ProductServlet")
public class ProductServlet extends HttpServlet {
    private ProductService pr=new ProductServiceImpl();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Category> list=pr.Selectpinpai();
        List<Product> list1=pr.xinpin();
        List<Product> list2=pr.remai();
        List<Slider> list3=pr.slider();
        request.getSession().setAttribute("list",list);
        request.getSession().setAttribute("xinpin",list1);
        request.getSession().setAttribute("remai",list2);
        request.getSession().setAttribute("list3",list3);
        request.getRequestDispatcher("index.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
